<template>
  <div class="ruzhu">
    <el-form :model="dataForm" ref="dataForm" label-width="80px">
      <el-row>
        <el-col :span="9">
          <el-card shadow="hover" style="margin-bottom: 15px;">
            <div slot="header" class="clearfix"><span>订价信息</span></div>
            <div class="ant-card-body">
              <el-form-item label="预定单号">
                <span v-if="dataForm.sysNo">{{singleEntity.sysNo}}</span>
              </el-form-item>
              <el-form-item label="入住类型" prop="checkinType">
                <span v-if="dataForm.checkinType == 0">全天</span>
                <span v-if="dataForm.checkinType == 1">时租</span>
                <span v-if="dataForm.checkinType == 2">自用</span>
                <span v-if="dataForm.checkinType == 3">免费</span>
              </el-form-item>
              <el-form-item label="预抵时间" prop="arrivalsTime">
                <el-row>
                  <el-col :span="12">
                    <span>{{ singleEntity.arrivalsTime }}</span>
                  </el-col>
                </el-row>
              </el-form-item>
              <el-form-item label="预离时间" prop="predissociationTime" v-if="dataForm.checkinType != 1">
                <el-row>
                  <el-col :span="12">
                    <span>{{ singleEntity.predissociationTime }}</span>
                  </el-col>
                </el-row>
              </el-form-item>
              <el-form-item label="时长" prop="days" v-if="dataForm.checkinType == 1">
                <span>{{ singleEntity.hoursName }}</span>
              </el-form-item>

              <el-form-item label="天数" v-if="dataForm.checkinType != 1">
                <span>{{ singleEntity.days }}</span>
              </el-form-item>
              <el-form-item label="早餐">
                <span>{{ singleEntity.zc }}</span>
              </el-form-item>
              <el-form-item label="客人类型" prop="sourceType">
                <el-row>
                  <el-col :span="6">
                    <span v-if="singleEntity.sourceType == 0">散客</span>
                    <span v-if="singleEntity.sourceType == 1">会员</span>
                    <span v-if="singleEntity.sourceType == 2">协议单位</span>
                    <span v-if="singleEntity.sourceType == 3">中介</span>
                  </el-col>
                  <el-col :span="8" style="margin-left: 10px;">
                    <el-popover v-if="singleEntity.sourceType != 0"
                      placement="top"
                      width="400"
                      trigger="hover">
                      <el-form-item label-width="0" v-if="singleEntity.sourceType == 1">
                        <div class="customerSourceBar" style="margin-bottom: 0;">
                          <div>
                            <div class="in_block">
                              <label class="fourChar">姓名:</label>
                              <label>{{ selectSellerMenber.name }}</label>
                            </div>
                            <div class="in_block">
                              <label>电话:</label>
                              <label>{{ selectSellerMenber.tel }}</label>
                            </div>
                            <div class="in_block">
                              <label class="fourChar">级别:</label>
                              <label>{{ selectSellerMenber.levelName }}</label>
                            </div>
                          </div>
                          <div>
                            <div class="in_block">
                              <label>储值:</label>
                              <label>{{ selectSellerMenber.balance }}</label>
                            </div>
                            <div class="in_block">
                              <label class="threeChar">积分:</label>
                              <label>{{ selectSellerMenber.score }}</label>
                            </div>
                            <div class="in_block">
                              <label class="threeChar">卡号:</label>
                              <label>{{ selectSellerMenber.cardNo }}</label>
                            </div>
                          </div>
                        </div>
                      </el-form-item>
                      <span slot="reference" v-if="singleEntity.sourceType != 0">{{ selectSellerMenber.name }} <label style="margin-left: 1px;" class="el-icon-question"></label></span>
                    </el-popover>

                  </el-col>
                </el-row>
              </el-form-item>



              <el-form-item label="房价方案" v-if="singleEntity.checkinType != 1">
                <span>{{schemeName ? schemeName : '--'}}</span>
              </el-form-item>
            </div>
          </el-card>
          <el-card shadow="hover" style="">
            <div slot="header" class="clearfix"><span>其他信息</span></div>
            <div class="ant-card-body">
              <el-row>
                <el-col :span="12">
                  <el-form-item label="联系人">
                    <span>{{ singleEntity.reserveName }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="电话">
                    <span>{{ singleEntity.reserveTel }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="担保方式">
                    <span v-if="singleEntity.guaranteeType == 0">无担保</span>
                    <span v-if="singleEntity.guaranteeType == 1">担保</span>
                    <span v-if="singleEntity.guaranteeType == 2">OTA担保</span>
                  </el-form-item>
                  <!-- 担保方式（0无担保1担保2OTA担保）-->
                </el-col>
                <el-col :span="12">
                  <el-form-item label="销售">
                    <span>{{ singleEntity.saleId }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="外部单号">
                    <span>{{ singleEntity.externalNo }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="备注">
                    <span>{{ singleEntity.remarks }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
          </el-card>
        </el-col>
        <el-col :span="15">
          <el-card shadow="hover" style="margin-bottom: 15px;" v-if="peopleEntity.state == 4">
            <div slot="header" class="clearfix"><span>选择房间</span></div>
            <div class="ant-card-body" v-loading="roomLoading" :element-loading-text="$t('Common.LoadingText')">
              <div class="title_day_price clear_float">
                <div class="pull">
                  <div style="cursor: pointer;">
                    <div class="in_block">
                      <span>房间数：</span>
                      <span>{{ reserveList.length }}间</span>
                    </div>
                    <div class="in_block">
                      <span>占房天数：</span>
                      <span>{{ dataForm.roomsDays }}晚</span>
                    </div>
                    <div class="in_block">
                      <span>总价：</span>
                      <span class="red_color1">￥ {{ dataForm.totalPrice.toFixed(2) }}</span>
                    </div>
                  </div>
                </div>
                <div class="push">
                  <el-button size="small" @click="zhika">制房卡</el-button>
                  <el-button size="small" @click="batchRowRoomBtn">批量排房</el-button>

                  <el-button size="small" @click="batchEntryBtn">批量入住</el-button>
                </div>
              </div>
              <el-table ref="table" :data="reserveList" style="width: 100%">
                <el-table-column align="center" width="50">
                  <template slot-scope="scope">
                    <span class="booking_circle_span orange_color verticalAlignUnset" v-if="scope.row.isMainRoom == 1"
                      style="margin-left: 4px;">主</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="排房" width="100" prop="floorRoomId">
                  <template slot-scope="scope">
                    <div v-if="scope.row.type == 0">
                      <div v-if="scope.row.floorRoomEntity">
                        <el-button type="text" @click="manualRoomBtn(scope.row)">{{ scope.row.floorRoomEntity.roomSign }}{{ scope.row.floorRoomEntity.roomNum }}</el-button>
                      </div>
                      <div v-else>
                        <el-button @click="manualRoomBtn(scope.row)" type="text">排房</el-button>
                      </div>
                    </div>
                    <div v-else>{{ scope.row.floorRoomEntity.roomSign }}{{ scope.row.floorRoomEntity.roomNum }}</div>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="房型" prop="roomName"></el-table-column>
                <el-table-column align="center" label="房价">
                  <template slot-scope="scope">
                    <div>
                      <label>{{ scope.row.prices.dateList[0][date.startDate1] }}</label>
                      <el-popover v-if="dataForm.checkinType != 1" placement="bottom" @show="editRoomPrice(scope.row)"
                        trigger="hover">
                        <!-- 新版-->
                        <div class="ant-popover-inner-content">
                          <div class="recent_price_ul table_recent_price_ul">
                            <table>
                              <thead>
                                <tr>
                                  <th>
                                    <div class="list_box clear_float">
                                      <span style="width: 100%;">价格</span>
                                    </div>
                                  </th>
                                </tr>
                              </thead>
                              <tbody>
                                <tr>
                                  <td>
                                    <div class="list_box clear_float">
                                      <span v-for="(priceItem, index) in setPrice.roomPrices.dateList" v-if="index < dataForm.days"
                                        :key="setPrice.roomId + ':' + index">
                                        <div>{{dateList[index]}}</div>
                                        <div style="margin-bottom: 6px;">
                                          <el-input-number size="mini" v-model="priceItem[dateList[index]]" :precision="2"
                                            :step="100" :min="0"></el-input-number>

                                        </div>
                                      </span>
                                    </div>
                                  </td>
                                </tr>
                              </tbody>
                            </table>
                          </div>
                        </div>

                        <!-- 旧版-->

                        <!-- <el-form label-width="100px" :inline="true" style="max-height: 300px !important;overflow-y: auto;">
                          <el-form-item v-for="(item, index) in setPrice.roomPrices.dateList" v-if="index < dataForm.days"
                            :key="setPrice.roomId + ':' + index" :label="dateList[index]">
                            <el-input @change="changeTotalPrice(reserveList)" style="100px" size="small" v-model="item[dateList[index]]"
                              placeholder="金额"></el-input>
                          </el-form-item>
                        </el-form> -->
                        <i class="el-icon-view" slot="reference" style="cursor: pointer;"></i>
                      </el-popover>
                    </div>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="操作">
                  <template slot-scope="scope">
                    <el-button v-if="scope.row.type == 0" size="mini" @click="reserveRuZhuBtn(scope.$index, scope.row)">入住</el-button>
                    <el-button v-if="scope.row.type == 1" size="mini" @click="viewCurrInfoOrderBtn(scope.$index, scope.row)">查看详单</el-button>
                    <el-button v-if="scope.row.isMainRoom == 0" size="mini" @click="settingMeetMainBtn(scope.$index, scope.row)">设主房</el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </el-card>
        </el-col>
      </el-row>
    </el-form>

    <!-- 价格弹窗 -->
    <el-dialog title="价格修改" :visible.sync="priceVisible" :append-to-body="true">
      <el-form label-width="100px">
        <el-form-item v-for="(item, index) in setPrice.roomPrices.dateList" v-if="index < dataForm.days" :key="setPrice.roomId + ':' + index"
          :label="dateList[index]">
          <el-input size="small" v-model="item[dateList[index]]" placeholder="金额"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer">
        <el-button @click="priceVisible = false">取消</el-button>
        <el-button type="primary" @click="dataFormSubmit()">{{ $t('Common.Confirm') }}</el-button>
      </span>
    </el-dialog>

    <addPeople v-if="addPeopleVisible" ref="addPeople" @refreClosing="unRoom"></addPeople>


    <el-dialog :visible="dialogshow" title="发门锁卡" :show-close="false" append-to-body class="famensuoka">
      <el-row>
        <el-col :span="12" style="border-right: 1px solid #ccc;text-align: center;padding-right:5px">
          <el-table :data="formlist" @row-click="addroomclick" highlight-current-row>
            <el-table-column property="roomSignNum" label="房号" width="100"></el-table-column>
            <el-table-column label="姓名" width="100">
              <template slot-scope="scope">
                <span>{{peopleEntity.name}}</span>
              </template>
            </el-table-column>
            <el-table-column property="indexlength" label="写卡数"></el-table-column>
            <!--     <el-table-column property="address" label="状态"></el-table-column> -->
          </el-table>
          <el-tag>合计</el-tag>
          <el-tag>房数: {{formlist.length}}</el-tag>
          <el-tag>卡数: {{kaindex}}</el-tag>
        </el-col>
        <el-col :span="12">
          <el-form ref="form" :model="form" label-width="100px">
            <el-form-item label="客人房号">
              <el-input :disabled="true" v-model="form.roomSignNum"></el-input>
            </el-form-item>
            <el-form-item label="失效时间">
              <el-date-picker v-model="this.reserveList[0].predissociationTime" type="datetime" :disabled="true"
                placeholder="选择日期时间">
              </el-date-picker>
            </el-form-item>
            <el-row style="margin-left: 100px;">
              <el-button @click="DoorNewCard(form)">制新卡</el-button>
              <el-button @click="DoorCopyCard(form)">复制卡</el-button>
              <el-button @click="DoorCancelCard(form)">注销</el-button>
            </el-row>
          </el-form>
        </el-col>
      </el-row>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="dialogshow=false">确 定</el-button>
      </div>
    </el-dialog>





    <!-- 选择房间-->
    <reserveRoomSelect v-if="reserveRoomSelectVisible" ref="reserveRoomSelect" @refreshDataList="refreshPaiFangList"></reserveRoomSelect>
  </div>
</template>

<script>
  import moment from 'moment';
  import reserveRoomSelect from './reserve-paifang';
  import addPeople from './ruzhuPeo';
  export default {
    data() {
      return {
        schemeName:'',
        addPeopleVisible: false,
        printDengjiDan: false,
        roomLoading: false,
        selectMenberFlag: false,
        selectSellerMenber: {
          name:"",
          tel:"",
          levelName:"",
          totalBalance:"",
          balance:"",
          totalScore:"",
          score:"",
          cardNo:"",
        },
        loading: false,
        yajinPrice: 0,
        authPrice: 0,
        yushouPrice: 0,
        singleEntity: {},
        newPrice: {},
        setPrice: {
          roomPrices: {
            dateList: []
          }
        },
        kaindex: 0,
        dialogshow: false,
        ruzhuPeoEntity: {},
        reserveRoomSelectVisible: false,
        priceVisible: false,
        // 押金类型为现付（0AR帐1现金2储值卡3积分兑换4银行卡5支付宝6微信）
        options: {
          sellerMenberOp: [],
          housOptions: [],
          paysTypeOptions: [],
          peopleTypeOptions: [
            // 身份类型（0居民身份证1户口簿2军官证3警官证4士兵证5护照6其他）
            {
              label: '居民身份证',
              value: '0'
            },
            {
              label: '户口簿',
              value: '1'
            },
            {
              label: '军官证',
              value: '2'
            },
            {
              label: '警官证',
              value: '3'
            },
            {
              label: '士兵证',
              value: '4'
            },
            {
              label: '护照',
              value: '5'
            },
            {
              label: '其他',
              value: '6'
            }
          ]
        },
        nowpays: [{
          nowType: '',
          payPrice: '',
          state: 2
        }],
        yunowpays: [{
          bankNumber: '',
          code: '',
          state: 2,
          payPrice: ''
        }],
        paysActiveName: 'first',
        // （0散客1会员2协议单位3中介）
        pickerOptions: {
          disabledDate(time) {
            return time.getTime() < Date.now();
          }
        },
        pickerOptions2: {
          disabledDate(time) {
            return (
              time.getTime() <
              moment()
              .add(-1, 'days')
              .getTime()
            );
          }
        },
        addRoomsList: [],
        zidingyiSwitch: false,
        ruzhuZhang: true,
        sourceTypeOptions: [{
            label: '散客',
            value: 0
          },
          {
            label: '会员',
            value: 1
          },
          {
            label: '协议单位',
            value: 2
          },
          {
            label: '中介',
            value: 3
          }
        ],
        guaranteeTypeOptions: [{
            label: '无担保',
            value: 0
          },
          {
            label: '有担保',
            value: 1
          },
          {
            label: 'OTA担保',
            value: 2
          }
        ],
        date: {
          startDate1: moment().format('YYYY-MM-DD'),
          startDate2: moment().format('HH:mm'),
          stopDate1: moment()
            .add(1, 'days')
            .format('YYYY-MM-DD'),
          stopDate2: '12:00'
        },
        housOptions: [],
        peopleEntity: {},
        item: {},
        selRow: {
          index: 0,
          row: {}
        },
        visible: false,
        dateList: [],
        reserveList: [],
        restaurantsquert: [],
        listrestaurantsa: [],
        userly: [],
        dataForm: {
          housId: '',
          sellerId: '',
          userId: '',
          memberId: '',
          reserveName: '',
          reserveTel: '',
          checkinType: 0,
          sysNo: 0,
          arrivalsTime: '',
          predissociationTime: '',
          days: 1,
          sourceType: 0,
          sourceName: '',
          activityId: '',
          guaranteeType: 0,
          saleId: '',
          externalNo: '',
          remarks: '',
          roomsNum: 0,
          roomsDays: 1,
          totalPrice: 0.0,
          creatTime: ''
        },
        form: {},
        formlist: [],
        dataFormsa: {
          skTime: '',
          zkUser: '',
          roomNum: '',
          kaNo: '',
          creatUserId: '',
          endTime: '',
          ckSfz: '',
          operation: '',
          creatTime: '',
          floorCengId: '',
          floorId: ''
        },
        doorLockParams: {
          RoomNumber: "",
          StartDate: "",
          EndDate: "",
          OpeartorType: "",
          CardID: "",
          skr: "",
          sfz: "",
          CardNum: ""
        },
        dataRule: {
          reserveName: [{
            required: true,
            message: '联系人不能为空',
            trigger: 'blur'
          }]
        }
      };
    },
    components: {
      reserveRoomSelect,
      addPeople
    },
    methods: {

      handleSelect() {
        this.getchemelist();

      },

      addroomclick(row, column, event) {
        this.form = row;
      },

      settingMeetMainBtn(index, row) {
        this.$confirm('是否确定设为主房?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          //发起请求
          this.$http({
            url: this.$http.adornUrl(
              `/hotel/roomReservation/settingMeetMain_room/${this.singleEntity.id}`),
            method: 'get',
            params: this.$http.adornParams({
              id: row.id
            })
          }).then(async ({
            data
          }) => {
            if (data && data.code === 0) {
              this.$emit('refreClosing');
              this.getInfo();
              this.$message({
                message: "操作成功",
                type: "success",
                duration: 1500
              });
            } else {
              this.$message.error(data.msg);
            }
          });
        }).catch(() => {

        });
      },
      zhika() {
        this.formlist = [];
        this.form = {};
        this.dialogshow = true;
        for (var i = 0; i < this.reserveList.length; i++) {
          if (this.reserveList[i].floorRoomEntity) {
            this.reserveList[i].floorRoomEntity["indexlength"] = 0;
            this.reserveList[i].floorRoomEntity["index"] = i;
            if (this.formlist.length == 0) {
              this.form = this.reserveList[i].floorRoomEntity;
            }
            this.formlist.push(this.reserveList[i].floorRoomEntity)
          }
        }
      },
      //注销卡
      DoorCancelCard(item) {

        this.doorLockParams.OpeartorType = "CancelCard";
        this.getkk(item);
      },

      //复制卡
      DoorCopyCard(item2) {
        this.formlist[item2.index].indexlength = this.formlist[item2.index].indexlength + 1;
        this.kaindex = this.kaindex + 1;
        this.doorLockParams.OpeartorType = "CopyCard";
        this.getkk(item2);
      },
      //制卡
      DoorNewCard(item2) {
        this.formlist[item2.index].indexlength = this.formlist[item2.index].indexlength + 1;
        this.kaindex = this.kaindex + 1;
        this.doorLockParams.OpeartorType = "NewCard";
        this.getkk(item2);
      },
      getkk(item2) {
        // methods["id"]=
        // console.log(methods)
        var result;
        this.$http({
          url: this.$http.adornUrl(`/hotel/business/Write`),
          method: 'post',
          data: this.$http.adornParams({
            id: item2.id,
           singleId: this.dataForm.id
          })
        }).then(({
          data
        }) => {
          this.doorLockParams.RoomNumber = data.roomNumber;
          this.doorLockParams.StartDate = data.StartDate;
          this.doorLockParams.EndDate = data.endDate;
          this.doorLockParams.CardID = data.CardID;
          this.doorLockParams.skr = data.skr;
          this.doorLockParams.sfz = data.sfz;
          this.doorLockParams.floorCengId = data.floorCengId
          this.doorLockParams.floorId = data.floorId
          this.doorLockParams.CardNum = data.CardNum;
          this.doorWriteCard(this.doorLockParams);
        });
      },
      doorWriteCard(doorLockParams) {
        var postData = {
          DeviceType: "DoorLockHareware",
          Params: JSON.stringify(doorLockParams)
        };
        this.Posts(postData, "Write");
      },
      Posts(postData, methods) {
        console.log(postData)
        var result;
        this.istrues = 0;
        this.axios({
          url: this.axios.postUrl(`/api/Service/` + methods),
          method: 'POST',
          data: postData,
          cache: false,
          async: false,
          contentType: "application/json",
        }).then(({
          data
        }) => {

          if (data.isSuccess == true) {
            this.istrues = 1;
            this.$message({
              message: "操作成功",
              type: "success",
              duration: 1500
            });
            this.savedataForm();
          } else {
            this.istrues = 1;
            this.$message({
              message: data.message,
              type: "error",
              duration: 1500
            });
          }

        })



      },
      savedataForm() {
        this.dataFormsa.skTime = this.doorLockParams.StartDate
        this.dataFormsa.zkUser = this.doorLockParams.skr
        this.dataFormsa.roomNum = this.doorLockParams.CardNum
        this.dataFormsa.kaNo = this.doorLockParams.RoomNumber
        this.dataFormsa.endTime = this.doorLockParams.EndDate
        this.dataFormsa.creatTime = this.doorLockParams.StartDate
        this.dataFormsa.floorCengId = this.doorLockParams.floorCengId
        this.dataFormsa.floorId = this.doorLockParams.floorId


        if (this.doorLockParams.OpeartorType == "NewCard") {
          this.dataFormsa.operation = "制新卡";
        } else if (this.doorLockParams.OpeartorType == "CopyCard") {
          this.dataFormsa.operation = "复制卡";
        } else {
          this.dataFormsa.operation = "注销卡";
        }
        this.$http({
          url: this.$http.adornUrl(`/hotel/tgatecard/save`),
          method: 'post',
          data: this.$http.adornData({
            'skTime': this.dataFormsa.skTime,
            'zkUser': this.dataFormsa.zkUser,
            'roomNum': this.dataFormsa.roomNum,
            'kaNo': this.dataFormsa.kaNo,
            'creatUserId': "",
            'sid': this.sid,
            'endTime': this.dataFormsa.endTime,
            'ckSfz': this.dataFormsa.ckSfz,
            'operation': this.dataFormsa.operation,
            'creatTime': this.dataFormsa.creatTime,
            'floorCengId': this.dataFormsa.floorCengId,
            'floorId': this.dataFormsa.floorId
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {

          } else {
            this.$message.error(data.msg)
          }
        })
      },

      getschemelist() {
        this.$http({
          url: this.$http.adornUrl('/hotel/thotelfloorscheme/listArray'),
          method: 'get',
          params: this.$http.adornParams({
            page: 1,
            limit: 999,
            type: this.singleEntity.sourceAgreenid
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.restaurantsquert = data.page.list;
            this.listrestaurantsa = data.page.list;
            console.log(this.listrestaurantsa)
            if(this.listrestaurantsa.length > 0){
              if(this.singleEntity.schemeId){
            console.log("this.singleEntity.schemeId",this.singleEntity.schemeId)
                var list = this.listrestaurantsa.filter(item=> item.id == this.singleEntity.schemeId)
            console.log("list",list)
                if(list.length > 0){
                  var entity = list[0]
                  this.schemeName =  entity.value
                }
              }
            }
          } else {
            this.restaurantsquert = [];
          }
        });

      },
      //单入住
      reserveRuZhuBtn(index, row) {
        this.clickRow = [row.id];
        this.addPeopleVisible = true;
        this.$nextTick(() => {
          this.$refs.addPeople.init(this.peopleEntity);
        });
        //    console.log(ids)
        //    this.$confirm('是否确定入住?', '提示', {
        //      confirmButtonText: '确定',
        //      cancelButtonText: '取消',
        //      type: 'warning'
        //    }).then(() => {
        //      //发起请求
        //      this.$http({
        //        url: this.$http.adornUrl(`/hotel/roomReservation/batch_row_room_ruzhu/${this.singleEntity.id}`),
        //        method: 'get',
        //        params: this.$http.adornParams({
        //          ids:ids.join(",")
        //        })
        //      }).then( async ({ data }) => {
        //        if (data && data.code === 0) {
        // this.$emit('refreClosing');
        //          this.getInfo();
        //          this.$message({
        //            message: "操作成功",
        //            type: "success",
        //            duration: 1500
        //          });
        //        } else {
        //          this.$message.error(data.msg);
        //        }
        //      });
        //    }).catch(() => {

        //    });
      },
      //单入住
      reserveRuZhuBtn2() {
        console.log("this.peopleEntity.id")
        console.log(this.peopleEntity.id)
        //发起请求
        this.$http({
          url: this.$http.adornUrl(`/hotel/roomReservation/row_room_ruzhu/${this.singleEntity.id}`),
          method: 'get',
          params: this.$http.adornParams({
            ids: this.clickRow.join(","),
            peoEntity: JSON.stringify(this.ruzhuPeoEntity),
            peopleId: this.peopleEntity.id
          })
        }).then(async ({
          data
        }) => {
          if (data && data.code === 0) {
            this.$emit('refreClosing');
            this.getInfo();
            this.$message({
              message: "操作成功",
              type: "success",
              duration: 1500
            });
          } else {
            this.$message.error(data.msg);
          }
        });
      },
      //批量入驻
      batchEntryBtn() {
        console.log("this.peopleEntity.id")
        console.log(this.peopleEntity.id)
        var ids = [];
        this.reserveList.forEach(item => {
          ids.push(item.id)
        })
        console.log(ids)
        this.$confirm('是否批量入住?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          //发起请求
          this.$http({
            url: this.$http.adornUrl(
              `/hotel/roomReservation/batch_row_room_ruzhu/${this.singleEntity.id}`),
            method: 'get',
            params: this.$http.adornParams({
              ids: ids.join(","),
              peopleId: this.peopleEntity.id
            })
          }).then(async ({
            data
          }) => {
            if (data && data.code === 0) {
              this.$emit('refreClosing');
              this.getInfo();
              this.$message({
                message: "操作成功",
                type: "success",
                duration: 1500
              });
            } else {
              this.$message.error(data.msg);
            }
          });
        }).catch(() => {

        });
      },
      batchRowRoomBtn() {
        var ids = [];
        this.reserveList.forEach(item => {
          ids.push(item.id)
        })
        console.log(ids)
        this.$confirm('是否批量排房?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          //发起请求
          this.$http({
            url: this.$http.adornUrl(
              `/hotel/roomReservation/batch_row_room/${this.singleEntity.id}`),
            method: 'get',
            params: this.$http.adornParams({
              ids: ids.join(",")
            })
          }).then(async ({
            data
          }) => {
            if (data && data.code === 0) {
              this.getInfo();
              this.$message({
                message: "操作成功",
                type: "success",
                duration: 1500
              });
            } else {
              this.$message.error(data.msg);
            }
          });
        }).catch(() => {

        });
      },
      getInfo() {
        this.floorRoomSign = true;
        this.$http({
          url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinsingle/pop_single/${this.peopleEntity.id}`),
          method: 'get',
          params: this.$http.adornParams()
        }).then(({
          data
        }) => {
          this.floorRoomSign = false;
          if (data && data.code === 0) {
            this.peopleEntity = data.data.peopleEntity;
            this.singleEntity = data.data.singleEntity;
            this.reserveList = data.data.singleReserveEntities;
            this.$nextTick(()=>{
              if(this.singleEntity.sourceType == 1){

              }
            })
          } else {
            this.$message.error(data.msg);
          }
        });
      },
      remoteMethod(query) {
        if (query !== '') {
          this.loading = true;
          this.$http({
            url: this.$http.adornUrl('/hotel/hotelmemberleveldetail/shareList'),
            method: 'get',
            params: this.$http.adornParams({
              page: 1,
              limit: 999,
              share:1,
              ruzhuQuery: query
            })
          }).then(({
            data
          }) => {
            if (data && data.code === 0) {
              console.log(data);
              this.options.sellerMenberOp = data.page.records;
              var that = this;
              if(that.singleEntity.sourceType == 1){
                if(that.options.sellerMenberOp.length > 0){
                  var list = that.options.sellerMenberOp.filter(item=>item.id == that.singleEntity.sourceName)
                  console.log(list)
                  if(list.length > 0){
                    var menber = list[0]
                    that.selectSellerMenber.name = menber.name;
                    that.selectSellerMenber.tel = menber.tel;
                    that.selectSellerMenber.levelName = menber.levelName;
                    that.selectSellerMenber.balance = menber.balance;
                    that.selectSellerMenber.score = menber.score;
                    that.selectSellerMenber.cardNo = menber.cardNo;
                  }
                  that.$forceUpdate();
                }
              }

            } else {
              this.options.sellerMenberOp = [];
            }
            this.loading = false;
          });
        } else {
          this.options.sellerMenberOp = [];
        }
      },
      //批量排房
      roomTagClose(tag, list) {
        list.splice(list.indexOf(tag), 1);
      },
      //查看详单
      viewCurrInfoOrderBtn(index, row) {
        this.$parent.viewCurrInfoOrderBtn(row);
      },
      init(singleEntity, singleReserveEntities, peopleEntity) {
        this.reserveList = singleReserveEntities;
        this.dataForm = singleEntity;
        this.peopleEntity = peopleEntity;
        this.singleEntity = singleEntity;
        this.visible = true;
        this.remoteMethod();
        this.getschemelist();
        this.$nextTick(() => {
          this.getdateList();
        });

      },
      refreshPaiFangList(arr) {
        
      },
      editRoomPrice(item) {
        this.setPrice = {};
        // this.priceVisible = true;
        this.newPrice = item;
        this.setPrice = {
          roomPrices: {
            ...item.prices
          }
        };
      },
      manualRoomBtn(row) {
        this.selRow.row = row;
        this.reserveRoomSelectVisible = true;

        this.$nextTick(() => {
          this.$refs.reserveRoomSelect.init(row, moment(this.singleEntity.arrivalsTime).format('YYYY-MM-DD') +
            ' 00:00', this.singleEntity.predissociationTime);
        });
      },
      //加载日期
      getdateList() {
        this.dateList = [];
        //加载90天内日期
        for (var i = 0; i < this.dataForm.days; i++) {
          this.dateList.push(
            moment(this.dataForm.arrivalsTime)
            .add(i, 'days')
            .format('YYYY-MM-DD')
          );
        }
      },
      hoursChange(hoursId) {
        console.log(hoursId);
        this.reqRoomHoursPrice(this.reserveList);
      }
    }
  };
</script>
<style lang="scss" scoped>
  .el-form-item {
    span {
      color: #17B3A3;
    }
  }

  .ant-card-bordered,
  .ant-card-head,
  .ant-table-bordered table,
  .ant-table-bordered td,
  .ant-table-bordered th {
    border-color: #d9e5ec !important;
  }

  .ant-card-head-wrapper {
    display: flex;
    align-items: center;
  }

  .ant-card-head-title {
    display: inline-block;
    flex: 1 1;
    padding: 8px 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .ant-card-head:after {
    clear: both;
  }

  .ant-card-head:after,
  .ant-card-head:before {
    content: '';
    display: table;
  }

  .ant-card-body,
  .ant-card-wider-padding .ant-card-body {
    padding: 16px;
  }

  .ant-layout-footer {
    background: #fff;
    text-align: right;
    border-top: 1px solid #e8e8e8;
  }

  .ant-layout-footer {
    padding: 12px 24px;
    color: #002140;
    font-size: 14px;
    background: #d9e5ec;
    bottom: 0px;
    width: 100%;
    left: 0px;
  }

  .el-button+.el-button {
    margin-left: 8px;
  }

  .title_day_price {
    padding: 0 0 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.25);
  }

  .title_day_price>.pull {
    font-weight: 700;
    margin-top: 6px;
  }

  .pull {
    float: left;
  }

  .clear_float:after {
    display: block;
    content: '';
    clear: both;
  }

  .title_day_price>.pull .in_block+.in_block {
    margin-left: 30px;
  }

  .push {
    float: right;
  }

  .in_block {
    display: inline-block;
  }

  .title_day_price>.pull .in_block>span:first-of-type {
    color: #666;
  }

  .title_day_price>.pull .in_block>span:nth-of-type(2) {
    color: #151515;
  }

  .red_color1 {
    color: #f24e4c !important;
  }

  .error_html .text {
    font-size: 14px;
    margin-top: 20px;
    margin-bottom: 20px;
  }

  .error_html {
    text-align: center;
    color: #000;
  }

  .el-form-item.in_block {
    margin-bottom: 8px;
  }

  .el-form-item {
    margin-bottom: 15px;
  }

  .add_room_cell .col_one {
    padding: 10px 0;
  }

  .push {
    float: right;
  }

  .pull {
    float: left;
  }

  .push a:hover {
    text-decoration: none;
    cursor: pointer;
  }

  .ant-divider,
  .ant-divider-vertical {
    position: relative;
    top: -0.06em;
    display: inline-block;
    width: 1px;
    height: 0.9em;
    margin: 0 8px;
    vertical-align: middle;
  }

  .ant-divider {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    color: #002140;
    font-size: 14px;
    font-variant: tabular-nums;
    line-height: 1.5;
    list-style: none;
    -webkit-font-feature-settings: 'tnum', 'tnum';
    font-feature-settings: 'tnum', 'tnum';
    background: #e8e8e8;
  }

  .pull>span,
  .add_room_cell .col_two>.pull>span {
    display: inline-block;
  }

  .pull>span+span {
    margin-left: 30px;
  }

  .customerSourceBar {
    padding: 8px 16px;
    box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.09);
  }

  @media screen and (min-width: 1441px) {
    .customerSourceBar {
      margin-left: auto;
      margin-right: auto;
    }
  }

  .customerSourceBar>div>.in_block:nth-of-type(2) {
    width: 37%;
  }

  .customerSourceBar>div>.in_block:first-of-type {
    width: 26%;
  }

  .in_block {
    display: inline-block;
  }

  .ant-form label {
    font-size: 14px;
  }

  .ruzhu #pane-first {
    max-height: 150px;
    overflow-y: auto;
  }


  .ant-popover-inner-content {
    padding: 12px 16px;
    color: #002140;

    .table_recent_price_ul {
      max-width: 900px;

      table {
        border-collapse: collapse;
        width: 100%;

        thead,
        th,
        tr,
        tt,
        u,
        ul,
          {
          font: inherit;
          font-size: 100%;
          margin: 0;
          padding: 0;
          vertical-align: initial;
          border: 0;
        }


      }

    }

  }

  .recent_price_ul table th>.list_box>span {
    line-height: 36px;
    background: #f0f0f0;
    height: 36px;
  }


  .recent_price_ul table td>.list_box>span {
    height: 95px;
  }

  .recent_price_ul table td>.list_box>span,
  .recent_price_ul table th>.list_box>span {
    float: left;
    width: 150px;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, .25);
    margin-left: -1px;
    margin-top: -1px;
  }

  .recent_price_ul table td:first-of-type>.list_box span>div:first-of-type,
  .recent_price_ul table td>.list_box>span>div:first-of-type {
    margin-top: 8px;
    margin-bottom: 6px;
  }

  .table_recent_price_ul.table_recent_price_ul td:nth-of-type(2) .list_box {
    max-height: 340px;
    overflow: auto;
  }
</style>
